package com.deyang.util;

import android.app.Activity;
import android.content.Context;

import pub.devrel.easypermissions.EasyPermissions;

/**
 * @author wangdyang
 * @createDate 2018年7月13日17:08:41
 * @desc 权限工具类
 */
public class PermissionUtil {


    /**
     * 判断是否存在权限
     *
     * @param context
     * @param permissions 判断权限
     * @return
     */
    public static boolean isHasPermission(Context context, String... permissions) {
        return EasyPermissions.hasPermissions(context, permissions);
    }


    /**
     * 判断是否存在权限
     *
     * @param activity
     * @param rationale   申请前提示
     * @param requestCode 申请码
     * @param permissions 申请权限
     */
    public static void requestPermissions(Activity activity, String rationale, int requestCode, String... permissions) {
        EasyPermissions.requestPermissions(activity, rationale, requestCode, permissions);
    }


}
